def idc_3d_view(request, idc_id):
    idc = get_object_or_404(IDC, id=idc_id)
    cabinets_data = [
        {
            'x': cabinet.x_position,
            'z': cabinet.z_position,
            'number': cabinet.number,
            'servers': [
                {'height': server.height}
                for server in cabinet.servers.all()
            ],
            'switchboards': [
                {'height': switchboard.height}
                for switchboard in cabinet.switchboards.all()
            ]
        }
        for cabinet in idc.cabinets.all()
    ]
    context = {
        'device_types': DeviceType.objects.all().order_by('name'),
        'devices': Device.objects.all().order_by('name'),
    }
    
    return render(request, 'monitor/idc_3d.html', {
        'idc': idc,
        'cabinets_data': json.dumps(cabinets_data),
       
    })